from flask import Flask
from exts import db,mail,cache,csrf,avatar
from models import auth
from flask_migrate import Migrate
from apps.front import front_bp
from apps.media import media_bp
from bbs_celery import make_celery
import config
import commands
app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)
mail.init_app(app)
cache.init_app(app)
csrf.init_app(app)
avatar.init_app(app)
migrate=Migrate(app,db)
mycelery=make_celery(app)
app.register_blueprint(front_bp)
app.register_blueprint(media_bp)

app.cli.command("init_board")(commands.init_board)
app.cli.command("init_posts")(commands.init_posts)

if __name__ == '__main__':
    app.run()
